#!/bin/bash

# 设置工作目录
WORK_DIR="/root/telltech"
cd $WORK_DIR

# 停止后端
if [ -f "$WORK_DIR/backend.pid" ]; then
    BACKEND_PID=$(cat $WORK_DIR/backend.pid)
    echo "Stopping backend service (PID: $BACKEND_PID)..."
    kill $BACKEND_PID
    rm $WORK_DIR/backend.pid
fi

# 停止前端
if [ -f "$WORK_DIR/frontend.pid" ]; then
    FRONTEND_PID=$(cat $WORK_DIR/frontend.pid)
    echo "Stopping frontend service (PID: $FRONTEND_PID)..."
    kill $FRONTEND_PID
    rm $WORK_DIR/frontend.pid
fi

echo "Services stopped successfully!" 